package com.kxf.androidtestdemo.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.bluetooth.BluetoothAdapter;
import android.os.Bundle;

import com.kxf.androidtestdemo.R;

public class BluetoothActivity extends AppCompatActivity {

    private BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bluetooth);

        if (bluetoothAdapter.isEnabled()){
            bluetoothAdapter.startDiscovery();
        }else {
            bluetoothAdapter.enable();
        }
    }
}